////////////////////////////////////////////////////////////////////////////////
// Copyright 2005 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   TASK
// AUTHOR           :   Ric Yik 
// DATE CREATE      :   2005/12/29
// DESCRIPTION      :   a DAO file for the function, TASK
//                  :   
//                  :   
//                  :   
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2005/01/04   Ric Yik         1.0                 Initial Version
//
//
//
////////////////////////////////////////////////////////////////////////////////
package com.erp.app.setup.taskMaster.beans;

import java.sql.Connection;
import java.util.ArrayList;

import com.erp.app.setup.taskMaster.dao.TaskDtlDao;
import com.erp.app.setup.taskMaster.pk.TaskHdrPk;
import com.erp.framework.exceptions.FindRecordException;
import com.erp.framework.model.dao.ServiceLocator;
import com.erp.framework.model.delegate.SimpleSearchMaintStyleDelegate;
import com.erp.framework.util.logger.Logger;

public class TaskDelegate extends SimpleSearchMaintStyleDelegate {
	public ArrayList getTaskDetails(String docType, String compCode) throws Exception {
		return this.getTaskDetails(new TaskHdrPk(compCode, docType, false));
	}

	public ArrayList getTaskDetails(String docType, String compCode, boolean getDefault) throws Exception {
		return this.getTaskDetails(new TaskHdrPk(compCode, docType, getDefault));
	}

	public ArrayList getTaskDetails(TaskHdrPk key) throws Exception {
		ArrayList rslt = null;
		Connection conn = null;
		try {
			conn = ServiceLocator.getInstance().getDSDBConnection();
			TaskDtlDao dao = new TaskDtlDao();
			rslt = dao.getTaskDetails(key, conn);
		} catch (Exception e) {
			Logger.logExceptions(this, e);
			throw new FindRecordException(e.getMessage());
		} finally {
			try {
				if (conn != null)
					conn.close();
			} catch (Exception e) {
				Logger.logExceptions(this, e);
			}
		}
		return rslt;
	}
}
